import launch
import launch_ros

def generate_launch_description():
    # 声明一个launch的参数
    action_declare_arg_background_g = launch.actions.DeclareLaunchArgument(
        'launch_arg_background',
        default_value='150',
        description='Red color for background')

    action_node_turtlesim_node = launch_ros.actions.Node(
            package='turtlesim',
            executable='turtlesim_node',
            # name='talker', # 节点名称
            parameters=[{'background_r': launch.substitutions.LaunchConfiguration('launch_arg_background',default='150')}], # 将launch参数传给节点
            output='both') # 2者个选项输出到屏幕和日志中
    
    action_node_turtle_patrol = launch_ros.actions.Node(
            package='demo_cpp_service',
            executable='turtle_patrol',
            # name='talker',
            output='screen')
    
    action_node_patrol_client = launch_ros.actions.Node(
            package='demo_cpp_service',
            executable='patrol_client',
            # name='talker',
            output='log')



    return launch.LaunchDescription([
        action_node_turtlesim_node,
        action_node_turtle_patrol,
        action_node_patrol_client,
        action_declare_arg_background_g
       
    ])